/*
 * sem_open
 *  - initialize and open a named semaphore
 */

#include <fcntl.h>          /* For O_* constants */
#include <sys/stat.h>       /* For mode constants */
#include <semaphore.h>

sem_t *sem_open(const char *name, int oflag);
sem_t *sem_open(const char *name, int oflag,
                mode_t mode, unsigned int value);

/*
 * sem_wait, semtimedwait, sem_trywait
 *  - lock a semaphre
 */

#include <semaphore.h>

int sem_wait(sem_t *sem);

int sem_trywait(sem_t *sem);

int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);


/*
 * sem_post
 *  - unlock a semaphore
 */

#include <semaphore.h>

int sem_post(sem_t *sem);

/*
 * sem_getvalue
 *  - get the value of a semaphore
 */

#include <semaphore.h>

int sem_getvalue(sem_t *sem, int *sval);

/*
 * sem_close
 *  - close a named semaphore
 */

#include <semaphore.h>

int sem_close(sem_t *sem);

/*
 * sem_unlink
 *  - remove a named semaphore
 */

#include <semaphore.h>

int sem_unlink(const char *name);

/*
 * sem_init
 *  - initialize an unnamed semaphore
 */

#include <semaphore.h>

int sem_init(sem_t *sem, int pshared, unsigned int value);

/*
 * sem_destroy
 *  - destroy an unnamed semaphore
 */

#include <semaphore.h>

int sem_destroy(sem_t *sem);
